package fanshe;

import java.io.File;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;

/*
 * 使用反射读取注解信息模拟处理注解信息的流程*/
public class demo03 {
	public static void main(String[] args) throws NoSuchFieldException, SecurityException {
		try {
		Class c=Class.forName("fanshe.student");
		Annotation[] ann=c.getAnnotations();
		//获得类的所有有效注解
		for (Annotation a : ann) {
			System.out.println(a);
		}
		//获得类的指定的注解
		sxttable st=(sxttable) c.getAnnotation(sxttable.class);
		System.out.println(st.value());
		//获得类的属性的注解
		Field f=c.getDeclaredField("studentName");
		sxtfile s=f.getAnnotation(sxtfile.class);
		System.out.println(s.columnName()+s.length()+s.type());
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
